<template>
    <div class="main-container">
        <div class="header">
            头部
        </div>
        <div>
            <div class="nav-bar-box">
                导航栏
            </div>
            <div class="content-box">
                <div class="item" v-for="item in arr1">{{ item }}</div>
            </div>
        </div>
    </div>
</template>

<script setup name="StickyDemo">
import { computed } from 'vue';

const arr1 = computed(() => {
    let arrA = [];
    for (let i = 1; i <= 8; i++) {
        arrA.push('A' + i);
    }
    return arrA;
})

</script>

<style>
.main-container {
    text-align: center;
}

.header {
    height: 40px;
    background-color: orange;
    font-size: 15px;
    line-height: 40px;
    text-align: center;
    position: fixed;
    width: 100%;
}

.nav-bar-box {
    height: 40px;
    background-color: skyblue;
    line-height: 40px;
    position: sticky;
    top: 40px;
}


.item {
    height: 300px;
    /* line-height: 300px; */
    background-color: gray;
    border-bottom: 1px solid #e6e6e6;
}

.content-box div:nth-child(1) {
    padding-top: 40px;
}


::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #99abd2;
}

::-webkit-scrollbar-track {
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 10px;
    background: #efefef;
}
</style>